package pl.edu.agh.mbc.persistance;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;


@Entity
@Table(name="USERS",  uniqueConstraints = {@UniqueConstraint(columnNames={"ID", "LOGIN"})})
public class User implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 4771962901096097665L;
	
	@Id
	@GeneratedValue(generator="sequence")
	@GenericGenerator(name="sequence", strategy = "sequence",
	parameters = {
	@Parameter(name="sequence", value="USERS_SEQ")
	}
	)
	@Column(name="ID")
	private Integer id;
	@Column(name="LOGIN")
	private String login;
	@Column(name="PASSWORD")
	private String password;
	
	public User(){
		
	}

	public User(Integer sid, String login, String password) {
		super();
		this.id = sid;
		this.login = login;
		this.password = password;
	}

	public int getId() {
		return id;
	}

	public String getLogin() {
		return login;
	}

	public String getPassword() {
		return password;
	}

	public void setId(int id) {
		this.id = id;
	}

	public void setLogin(String login) {
		this.login = login;
	}
	public void setPassword(String password) {
		this.password = password;
	}

	@Override
	public String toString() {
		return "User [id=" + id + ", login=" + login + ", password=" + password
				+ "]";
	}
	 
}
